package cn.ywang.pattern.jdk;

import java.util.Observable;
import java.util.Observer;

/**
 * @author BeatificWang
 * @date 2019/3/20 23:20
 */
public class Developer implements Observer {

	private String name;

	public Developer(String name) {
		this.name = name;
	}

	/**
	 * This method is called whenever the observed object is changed. An
	 * application calls an <tt>Observable</tt> object's
	 * <code>notifyObservers</code> method to have all the object's
	 * observers notified of the change.
	 *
	 * @param o   the observable object.
	 * @param arg an argument passed to the <code>notifyObservers</code>
	 */
	@Override
	public void update(Observable o, Object arg) {
		Tester tester = (Tester) o;
		Issue issue = (Issue) arg;
		System.out.println("Hi " + this.name + ", " + tester.getName() + "提交了一个缺陷：" + issue + "请查看");
	}

}
